From: Richard M. Stallman Date: Sun, 29 Sep 2002 03:34:12 +0000 (+0000) Subject: (unload-feature): When undefining a variable, delete its buffer-local bindings. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~30378 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=213fa5ee844a02a7420bb95dcdc5dfa18d945e1a;p=emacs.git (unload-feature): When undefining a variable, delete its buffer-local bindings. --- diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 00597615c2d..e609596e4a8 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -167,8 +167,14 @@ is nil, raise an error." ;; Remove any feature names that this file provided. (if (eq (car x) 'provide) (setq features (delq (cdr x) features))) - (if (eq (car x) 'defvar) - (makunbound (cdr x)))) + (when (eq (car x) 'defvar) + ;; Kill local values as much as possible. + (dolist (buf (buffer-list)) + (with-current-buffer buf + (kill-local-variable (cdr x)))) + ;; Get rid of the default binding if we can. + (unless (local-variable-if-set-p (cdr x)) + (makunbound (cdr x))))) (t (when (fboundp x) (if (fboundp 'ad-unadvise)